home *** CD-ROM | disk | FTP | other *** search
/ Game Cracker (Expanded Edition) / Game Cracker (Expanded Edition).iso / cracks / NQRACCRK.ZIP / Crack.asm next >
Encoding:
Assembly Source File  |  1998-05-30  |  5.2 KB  |  160 lines

  1. .model tiny
  2. .code
  3. Jumps
  4.  
  5.       ORG     100H
  6.  
  7. start:          JMP     begin
  8.  
  9. ;******************************************************************************
  10. Patch           dw      data1,data2,data3,0
  11.  
  12. data1           dd      2E3CCh
  13.                 dw      5
  14.                 db      90h,0EBh,5Ah,0EBh,58h
  15.  
  16. data2           dd      37BBBh
  17.                 dw      6
  18.                 db      0B3h,00,66h,51h,8Ah,0Dh
  19.  
  20. data3           dd      37BCBh
  21.                 dw      4
  22.                 db      66h,59h,0EBh,02
  23.  
  24. logo            DB 'Cracker for Network Q Rally',0AH,0DH
  25.                 DB '~~~~~~~~~~~~~~~~~~~~~~~~~~~',0AH,0DH
  26.                 DB '$'
  27.  
  28. Ok              DB 'Ok! RallyC are now cracked!',10,13,'$'
  29.  
  30. notfound        DB 'FILE NOT FOUND',0AH,0DH
  31.                 DB 'Make sure you start CRACK.COM in the same '
  32.                 DB 'directory as '
  33. FileName        DB 'RAL.EXE',0           ;the name of the file to be patched
  34.                 DB ,0AH,0DH,'$'
  35.  
  36. fatal           DB 'A fatal error has occured',0AH,0DH
  37.                 DB 'the crack was not applied',0AH,0DH
  38.                 DB '$'
  39.  
  40. handle          DW      0
  41. attr            dw      0
  42. ;******************************************************************************
  43. ;       this procedure type error message and exit program
  44. ;******************************************************************************
  45.  
  46. Error:          lea     dx,NotFound
  47.                 cmp     ax,2
  48.                 je      TypeMSG
  49.                 lea     dx,Fatal
  50. TypeMSG:        mov     ah,9
  51.                 int     21h
  52.                 mov     ax,4C01h
  53.                 int     21h
  54.  
  55. ;******************************************************************************
  56. ;       this procedure opens the file to be cracked
  57. ;******************************************************************************
  58.  
  59. open_it         proc    near
  60.  
  61.                 lea     dx,FileName
  62.                 mov     ax,4300h
  63.                 int     21h                     ;get file attr
  64.                 mov     [Attr],cx
  65.                 jc      Error
  66.  
  67.                 and     cx,0FFFEh               ;clear ReadOnly bit
  68.                 mov     ax,4301h
  69.                 int     21h                     ;set file attr
  70.                 jc      Error
  71.  
  72.  
  73.                 lea     dx,FileName
  74.                 mov     ax,3d02h
  75.                 int     21h
  76.                 jc      Error                   ;open file to be cracked
  77.  
  78.                 mov     Handle,ax               ;store the file handle for
  79.                 ret                             ;use later and return
  80.  
  81. open_it         endp
  82.  
  83. ;******************************************************************************
  84. ;       this procedure writes the crack to the file
  85. ;
  86. ;******************************************************************************
  87.  
  88. patch_it        proc    near
  89.  
  90.                 mov     dx,[di]
  91.                 mov     cx,[di+2]
  92.                 mov     ah,42h                  ;setup to move the file
  93.                 mov     al,00h                  ;pointer to the patch site
  94.                 mov     bx,[Handle]             ;load the file handle
  95.                 int     21h                     ;move the pointer
  96.                 jc      Error
  97.  
  98.                 mov     cx,[di+4]
  99.                 mov     dx,di
  100.                 add     dx,6
  101.                 mov     ah,40h                  ;setup to write the crack
  102.                 mov     bx,[Handle]             ;load file handle
  103.                 int     21h                     ;make the patch
  104.                 jc      Error
  105.                 ret
  106.  
  107. patch_it        endp
  108.  
  109. ;******************************************************************************
  110. ;       this procedure close file
  111. ;******************************************************************************
  112.  
  113. close_it        proc    near
  114.  
  115.                 mov     bx,[Handle]             ;load file handle
  116.                 mov     ah,3eh
  117.                 int     21h                     ;close file and return
  118.  
  119.                 lea     dx,FileName
  120.                 mov     cx,[Attr]
  121.                 mov     ax,4301h
  122.                 int     21h                     ;restore file attr
  123.                 ret
  124.  
  125. close_it        endp
  126.  
  127. ;******************************************************************************
  128. ;       the main program
  129. ;******************************************************************************
  130.  
  131. begin           proc    near
  132.  
  133.                 mov     ah,09h
  134.                 lea     dx,Logo                 ;display logo
  135.                 int     21h
  136.  
  137.                 call    open_it                 ;open file to be patched
  138.  
  139.                 lea     si,Patch
  140.  
  141. Next:           mov     di,[si]
  142.                 add     si,2
  143.                 or      di,di
  144.                 jz      _End
  145.                 call    patch_it                ;make the patch
  146.                 jmp     Next
  147. _End:
  148.                 call    close_it
  149.  
  150.                 mov     ah,09h
  151.                 lea     dx,Ok                   ;display ok
  152.                 int     21h
  153.  
  154.                 mov     ax,4C00h                ;exit
  155.                 int     21h
  156.  
  157. begin           ENDP
  158.  
  159.                 END     START
  160.